import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllSubClasses = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        subClassesLoading: false,
        subClasses: [],
    });

    const loadAllSubClasses = async () => {
        state.subClassesLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let commodities = res?.a?.nodes || [];
        let subClasses = [0, 1, 3, 3, 3, 3, 3]
        state.subClasses = subClasses;
        state.subClassesLoading = false;
        // return commodities;
    };

    return { ...state, loadAllSubClasses };
};

const query = compress(``);

export default useAllSubClasses;
